package com.itheima.controller;
import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.entity.Result;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;
    /**
     * 统计员工性别分布
     * @return
     */
    @GetMapping("/empGenderData")
    public Result empGenderData(){
        List<Map> dataList = reportService.empGenderData();
        return Result.success(dataList);
    }

    /**
     * 统计各个职位的员工人数
     * @return
     */
    @GetMapping("/empJobData")
    public Result empJobData(){
        JobOption jobOption = reportService.empJobData();
        return Result.success(jobOption);
    }

    /**
     * 学员学历统计
     * @return
     */
    @GetMapping("/studentDegreeData")
//    1: 初中, 2: 高中 , 3: 大专 , 4: 本科 , 5: 硕士 , 6: 博士
    public Result studentDegreeData(){
        List<Map> dataList = reportService.studentDegreeData();
        return Result.success(dataList);
    }

    /**
     * 班级人数统计
     * @return
     */
    @GetMapping("/studentCountData")
    public Result studentCountData(){
        ClazzOption clazzOption =reportService.studentCountData();
        return Result.success(clazzOption);
    }
}
